//
//  WLMBaseNavitionController.swift
//  WeiBo
//
//  Created by Eric on 2017-01-04.
//  Copyright © 2017 Eric. All rights reserved.
//

import UIKit

class WLMBaseNavitionController: UINavigationController {

    override func viewDidLoad() {
        super.viewDidLoad()

        // Do any additional setup after loading the view.
    }

    override func pushViewController(_ viewController: UIViewController, animated: Bool) {
        let count = self.childViewControllers.count
        
        if count > 0 {
            viewController.navigationItem.leftBarButtonItem = UIBarButtonItem(imageName: "navigationbar_back_withtext", titleName: "返回", target: self, action: #selector(close))
            viewController.hidesBottomBarWhenPushed = true
        }
        super.pushViewController(viewController, animated: animated)
        
    }
    
   @objc private func close() {
        self.popViewController(animated: true)
    }

}
